# -*- coding: utf-8 -*-
from datetime import timedelta
from jms.ods.others.yl_sms_send_detail import jms_ods__yl_sms_send_detail
from utils.operators.cluster_for_spark_sql_operator import SparkSqlOperator

jms_dwd__dwd_yl_sms_send_detail_base_dt = SparkSqlOperator(
    task_id='jms_dwd__dwd_yl_sms_send_detail_base_dt',
    email=['payne.jiang@jtexpress.com','yl_bigdata@yl-scm.com'],
    master='yarn',
    name='jms_dwd__dwd_yl_sms_send_detail_base_dt_{{ execution_date | cst_hour }}',
    sql='jms/dwd/dwd_yl_sms_send_detail_base_dt/execute.sql',
    pool_slots=3,
    executor_cores=2 , 
    executor_memory='4G' ,
    num_executors=2 , 
    conf={'spark.dynamicAllocation.enabled'                  : 'true',
          'spark.shuffle.service.enabled'                    : 'true',
        'spark.dynamicAllocation.maxExecutors'             : 2 , 
          'spark.dynamicAllocation.cachedExecutorIdleTimeout': 60,
          'spark.sql.sources.partitionOverwriteMode'         : 'dynamic',
        'spark.executor.memoryOverhead'             : '1G' , 
          'spark.sql.shuffle.partitions'                     :1,
          },
    hiveconf={'hive.exec.dynamic.partition'             : 'true',  # 动态分区
              'hive.exec.dynamic.partition.mode'        : 'nonstrict',
              'hive.exec.max.dynamic.partitions'        : 2500,  # 最大分区
              'hive.exec.max.dynamic.partitions.pernode': 2500,  # 最大分区
              },
    yarn_queue='pro',
    execution_timeout=timedelta(minutes=30),
    retries=2,
    )
jms_dwd__dwd_yl_sms_send_detail_base_dt << [jms_ods__yl_sms_send_detail]
